﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Text;
using System.Security.Cryptography;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      //if 
    }

    /*
    private string Encrypt_Pass(string p)
    {

        UnicodeEncoding encoding = new UnicodeEncoding();
        Byte[] hashBytes = encoding.GetBytes(p);
        // Compute the SHA-1  hash
        SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider();
        Byte[] cryptPassword = sha1.ComputeHash(hashBytes);

        return BitConverter.ToString(cryptPassword);

    }
    private void checkLogin(string username, string password)
    {
        password = Encrypt_Pass(password);
        User u = new User();
             
        if (!u.checkLogin(username, password))           
             mpOKMsg.ShowMessage("Login fail!");
        else
        {
            Session["username"] = u.UserName;
           // Response.Redirect("index.aspx");
        }

    }
    protected void btnLogin_Click(object sender, EventArgs e)
    {

        if (txtUserName.Text == "")
            mpOKMsg.ShowMessage("Please enter username.");
        else if (txtPassword.Text=="")
            mpOKMsg.ShowMessage("Please enter password.");
        else checkLogin(txtUserName.Text, txtPassword.Text);
    }
      */
}
